#include <iostream>
using namespace std;
typedef long long LL;
#define endl '\n'
void solve() 
{
    int x; cin >> x;
	int maxm = 0, ans = 0;
	for(int y = 1; y < 2024; y++)
	{
		if(x * y % 2024 > maxm)
		{
			maxm = x * y % 2024;
			ans = y;
		}
	}
	cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T = 1;

	while(T--)
	{
        solve();
	}
	return 0;
}